package com.yuda.campsite.service.impl;

import java.util.List;

import com.yuda.campsite.domain.CampsiteOrder;
import com.yuda.campsite.mapper.CampsiteOrderMapper;
import com.yuda.campsite.service.ICampsiteOrderService;
import com.yuda.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 订单Service业务层处理
 *
 * @author wyn
 * @date 2021-09-27
 */
@Service
public class CampsiteOrderServiceImpl implements ICampsiteOrderService
{
    @Autowired
    private CampsiteOrderMapper campsiteOrderMapper;

    /**
     * 查询订单
     *
     * @param id 订单ID
     * @return 订单
     */
    @Override
    public CampsiteOrder selectCampsiteOrderById(Long id)
    {
        return campsiteOrderMapper.selectCampsiteOrderById(id);
    }

    /**
     * 查询订单列表
     *
     * @param campsiteOrder 订单
     * @return 订单
     */
    @Override
    public List<CampsiteOrder> selectCampsiteOrderList(CampsiteOrder campsiteOrder)
    {
        return campsiteOrderMapper.selectCampsiteOrderList(campsiteOrder);
    }

    /**
     * 新增订单
     *
     * @param campsiteOrder 订单
     * @return 结果
     */
    @Override
    public int insertCampsiteOrder(CampsiteOrder campsiteOrder)
    {
        return campsiteOrderMapper.insertCampsiteOrder(campsiteOrder);
    }

    /**
     * 修改订单
     *
     * @param campsiteOrder 订单
     * @return 结果
     */
    @Override
    public int updateCampsiteOrder(CampsiteOrder campsiteOrder)
    {
        campsiteOrder.setUpdateTime(DateUtils.getNowDate());
        return campsiteOrderMapper.updateCampsiteOrder(campsiteOrder);
    }

    /**
     * 批量删除订单
     *
     * @param ids 需要删除的订单ID
     * @return 结果
     */
    @Override
    public int deleteCampsiteOrderByIds(Long[] ids)
    {
        return campsiteOrderMapper.deleteCampsiteOrderByIds(ids);
    }

    /**
     * 删除订单信息
     *
     * @param id 订单ID
     * @return 结果
     */
    @Override
    public int deleteCampsiteOrderById(Long id)
    {
        return campsiteOrderMapper.deleteCampsiteOrderById(id);
    }

    @Override
    public Integer XuiGaiEndTime(Long endTime, Long campsiteId) {
        return campsiteOrderMapper.XuiGaiEndTime(endTime, campsiteId);
    }

    @Override
    public List<CampsiteOrder> ChaKanNumOfStatus(String campsiteId) {
        return campsiteOrderMapper.ChaKanNumOfStatus(campsiteId);
    }
}
